package com.plian.system.service.tb.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.plian.Tools.CollectionUtil;
import com.plian.system.entity.tb.MeetingAttendee;
import com.plian.system.mapper.tb.MeetingAttendeeMapper;
import com.plian.system.mybatis.base.BaseServiceImpl;
import com.plian.system.service.tb.IMeetingAttendeeService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author: Take-off
 * @Description: TODO 会议列席人
 * @Date: 2022/12/29 2:04 PM
 * @Version: 1.0
 **/
@Service
@AllArgsConstructor
public class MeetingAttendeeServiceImpl extends BaseServiceImpl<MeetingAttendeeMapper, MeetingAttendee> implements IMeetingAttendeeService {


    @Override
    public boolean deleteByParentId(List<Long> ids) {
        LambdaQueryWrapper<MeetingAttendee> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(MeetingAttendee::getBaseMeetingId, ids);
        List<MeetingAttendee> tripleMeetingTopics = list(queryWrapper);
        if (CollectionUtil.isNotEmpty(tripleMeetingTopics)){
            return deleteLogic(tripleMeetingTopics.stream().map(MeetingAttendee::getId).collect(Collectors.toList()));
        }
        return true;
    }
}
